<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>psychsim.agent.Agent</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />
  <script type="text/javascript" src="epydoc.js"></script>
</head>

<body bgcolor="white" text="black" link="blue" vlink="#204080"
      alink="#204080">
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="psychsim.world.World-class.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://pynadath.net:81/projects/psychsim">PsychSim</a></th>
          </tr></table></th>
  </tr>
</table>
<table width="100%" cellpadding="0" cellspacing="0">
  <tr valign="top">
    <td width="100%">
      <span class="breadcrumbs">
        <a href="psychsim-module.html">Package&nbsp;psychsim</a> ::
        <a href="psychsim.agent-module.html">Module&nbsp;agent</a> ::
        Class&nbsp;Agent
      </span>
    </td>
    <td>
      <table cellpadding="0" cellspacing="0">
        <!-- hide/show private -->
        <tr><td align="right"><span class="options">[<a href="javascript:void(0);" class="privatelink"
    onclick="toggle_private();">hide&nbsp;private</a>]</span></td></tr>
        <tr><td align="right"><span class="options"
            >[<a href="frames.html" target="_top">frames</a
            >]&nbsp;|&nbsp;<a href="psychsim.agent.Agent-class.html"
            target="_top">no&nbsp;frames</a>]</span></td></tr>
      </table>
    </td>
  </tr>
</table>
<!-- ==================== CLASS DESCRIPTION ==================== -->
<h1 class="epydoc">Class Agent</h1><p class="nomargin-top"><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent">source&nbsp;code</a></span></p>
<!-- ==================== INSTANCE METHODS ==================== -->
<a name="section-InstanceMethods"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Methods</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceMethods"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__init__"></a><span class="summary-sig-name">__init__</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.__init__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#decide" class="summary-sig-name">decide</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">vector</span>,
        <span class="summary-sig-arg">horizon</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">others</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">tiebreak</span>=<span class="summary-sig-default">None</span>)</span><br />
      Generate an action choice for this agent in the given state</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.decide">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#value" class="summary-sig-name">value</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">vector</span>,
        <span class="summary-sig-arg">action</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">horizon</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">others</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>)</span><br />
      Computes the expected value of a state vector (and optional action 
      choice) to this agent</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.value">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="valueIteration"></a><span class="summary-sig-name">valueIteration</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">horizon</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">ignore</span>=<span class="summary-sig-default"><code class="variable-group">[</code><code class="variable-group">]</code></span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">epsilon</span>=<span class="summary-sig-default">1e-06</span>)</span><br />
      Compute a value function for the given model</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.valueIteration">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="setPolicy"></a><span class="summary-sig-name">setPolicy</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">policy</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">level</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setPolicy">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#setHorizon" class="summary-sig-name">setHorizon</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">horizon</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">level</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setHorizon">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#setParameter" class="summary-sig-name">setParameter</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">value</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">None</span>,
        <span class="summary-sig-arg">level</span>=<span class="summary-sig-default">None</span>)</span><br />
      Set a parameter value for the given model(s)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setParameter">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a href="psychsim.action.ActionSet-class.html" 
      class="link">ActionSet</a></span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#addAction" class="summary-sig-name">addAction</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">action</span>,
        <span class="summary-sig-arg">condition</span>=<span class="summary-sig-default">None</span>)</span><br />
      Returns:
      the action added</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.addAction">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">{<a href="psychsim.action.ActionSet-class.html" 
      class="link">ActionSet</a>}</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#getActions" class="summary-sig-name">getActions</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">vector</span>)</span><br />
      Returns:
      the set of possible actions to choose from in the given state vector</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.getActions">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#setLegal" class="summary-sig-name">setLegal</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">action</span>,
        <span class="summary-sig-arg">tree</span>)</span><br />
      Sets the legality decision tree for a given action</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setLegal">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">bool</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#hasAction" class="summary-sig-name">hasAction</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">atom</span>)</span><br />
      Returns:
      <code>True</code> iff this agent has the given action (possibly in 
      combination with other actions)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.hasAction">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="setState"></a><span class="summary-sig-name">setState</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">feature</span>,
        <span class="summary-sig-arg">value</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setState">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="setReward"></a><span class="summary-sig-name">setReward</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">tree</span>,
        <span class="summary-sig-arg">weight</span>=<span class="summary-sig-default">0.0</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setReward">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">float</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#reward" class="summary-sig-name">reward</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">vector</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>)</span><br />
      Returns:
      the reward I derive in the given state (under the given model, 
      default being the <code>True</code> model)</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.reward">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">dict</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#addModel" class="summary-sig-name">addModel</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">**kwargs</span>)</span><br />
      Adds a new possible model for this agent (to be used as either true 
      model or else as mental model another agent has of it).</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.addModel">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="predict"></a><span class="summary-sig-name">predict</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">vector</span>,
        <span class="summary-sig-arg">name</span>,
        <span class="summary-sig-arg">V</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.predict">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">int</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#model2index" class="summary-sig-name">model2index</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">model</span>)</span><br />
      Convert a model name to a numeric representation</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.model2index">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">str</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#index2model" class="summary-sig-name">index2model</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">index</span>)</span><br />
      Convert a numeric representation of a model to a name</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.index2model">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="setRecursiveLevel"></a><span class="summary-sig-name">setRecursiveLevel</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">level</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setRecursiveLevel">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="setBelief"></a><span class="summary-sig-name">setBelief</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">key</span>,
        <span class="summary-sig-arg">distribution</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setBelief">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="getBelief"></a><span class="summary-sig-name">getBelief</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>,
        <span class="summary-sig-arg">world</span>=<span class="summary-sig-default">None</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.getBelief">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="printBeliefs"></a><span class="summary-sig-name">printBeliefs</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.printBeliefs">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a href="psychsim.agent.Agent-class.html#observe" class="summary-sig-name">observe</a>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">state</span>,
        <span class="summary-sig-arg">actions</span>,
        <span class="summary-sig-arg">model</span>=<span class="summary-sig-default">True</span>)</span><br />
      Returns:
      the post-observation beliefs of this agent</td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.observe">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__copy__"></a><span class="summary-sig-name">__copy__</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.__copy__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="__xml__"></a><span class="summary-sig-name">__xml__</span>(<span class="summary-sig-arg">self</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.__xml__">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
      <table width="100%" cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><span class="summary-sig"><a name="parse"></a><span class="summary-sig-name">parse</span>(<span class="summary-sig-arg">self</span>,
        <span class="summary-sig-arg">element</span>)</span></td>
          <td align="right" valign="top">
            <span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.parse">source&nbsp;code</a></span>
            
          </td>
        </tr>
      </table>
      
    </td>
  </tr>
</table>
<!-- ==================== INSTANCE VARIABLES ==================== -->
<a name="section-InstanceVariables"></a>
<table class="summary" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Instance Variables</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-InstanceVariables"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a href="psychsim.pwl.KeyedTree-class.html" 
      class="link">KeyedTree</a></span>
    </td><td class="summary">
        <a name="O"></a><span class="summary-name">O</span><br />
      the observation function; default is <code>True</code>, which means 
      perfect observations of actions
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">{<a href="psychsim.action.Action-class.html" class="link">Action</a>}</span>
    </td><td class="summary">
        <a name="actions"></a><span class="summary-name">actions</span><br />
      the set of possible actions that the agent can choose from
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a href="psychsim.action.ActionSet-class.html" 
      class="link">ActionSet</a>&rarr;<a 
      href="psychsim.pwl.KeyedPlane-class.html" class="link">KeyedPlane</a></span>
    </td><td class="summary">
        <a name="legal"></a><span class="summary-name">legal</span><br />
      a set of conditions under which certain action choices are allowed 
      (default is that all actions are allowed at all times)
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">str</span>
    </td><td class="summary">
        <a name="name"></a><span class="summary-name">name</span><br />
      agent name
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type">&nbsp;</span>
    </td><td class="summary">
        <a name="omega"></a><span class="summary-name">omega</span><br />
      the set of possible observations this agent may receive
    </td>
  </tr>
<tr>
    <td width="15%" align="right" valign="top" class="summary">
      <span class="summary-type"><a href="psychsim.world.World-class.html" class="link">World</a></span>
    </td><td class="summary">
        <a name="world"></a><span class="summary-name">world</span><br />
      the environment that this agent inhabits
    </td>
  </tr>
</table>
<!-- ==================== METHOD DETAILS ==================== -->
<a name="section-MethodDetails"></a>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr bgcolor="#70b0f0" class="table-header">
  <td colspan="2" class="table-header">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
      <tr valign="top">
        <td align="left"><span class="table-header">Method Details</span></td>
        <td align="right" valign="top"
         ><span class="options">[<a href="#section-MethodDetails"
         class="privatelink" onclick="toggle_private();"
         >hide private</a>]</span></td>
      </tr>
    </table>
  </td>
</tr>
</table>
<a name="decide"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">decide</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">vector</span>,
        <span class="sig-arg">horizon</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">others</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">model</span>=<span class="sig-default">True</span>,
        <span class="sig-arg">tiebreak</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.decide">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Generate an action choice for this agent in the given state</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>vector</code></strong> (<a href="psychsim.pwl.KeyedVector-class.html" 
          class="link">KeyedVector</a>) - the current state in which the agent is making its decision</li>
        <li><strong class="pname"><code>horizon</code></strong> (int) - the value function horizon (default is use horizon specified in 
          model)</li>
        <li><strong class="pname"><code>others</code></strong> (str&rarr;<a href="psychsim.action.ActionSet-class.html" 
          class="link">ActionSet</a>) - the optional action choices of other agents in the current time 
          step</li>
        <li><strong class="pname"><code>model</code></strong> (str) - the mental model to use (default is <code>True</code>)</li>
        <li><strong class="pname"><code>tiebreak</code></strong> (str) - what to do in case multiple actions have the same expected value
          <ul>
            <li>
              random: choose one of the actions at random
            </li>
            <li>
              distribution: return a uniform distribution over the actions
            </li>
            <li>
              None: make a deterministic choice among the actions (default)
            </li>
          </ul></li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="value"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">value</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">vector</span>,
        <span class="sig-arg">action</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">horizon</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">others</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">model</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.value">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Computes the expected value of a state vector (and optional action 
  choice) to this agent</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>vector</code></strong> (<a href="psychsim.pwl.KeyedVector-class.html" 
          class="link">KeyedVector</a>) - the state vector (not distribution) representing the possible 
          world under consideration</li>
        <li><strong class="pname"><code>action</code></strong> (<a href="psychsim.action.ActionSet-class.html" 
          class="link">ActionSet</a>) - prescribed action choice for the agent to evaluate; if 
          <code>None</code>, then use agent's own action choice (default is
          <code>None</code>)</li>
        <li><strong class="pname"><code>horizon</code></strong> (int) - the number of time steps to project into the future (default is 
          agent's horizon)</li>
        <li><strong class="pname"><code>others</code></strong> (str&rarr;<a href="psychsim.action.ActionSet-class.html" 
          class="link">ActionSet</a>) - optional table of actions being performed by other agents in this
          time step (default is no other actions)</li>
        <li><strong class="pname"><code>model</code></strong> - the model of this agent to use (default is <code>True</code>)</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="setHorizon"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">setHorizon</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">horizon</span>,
        <span class="sig-arg">model</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">level</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setHorizon">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>model</code></strong> - the model to set the horizon for, where <code>None</code> means 
          set it for all (default is <code>None</code>)</li>
        <li><strong class="pname"><code>level</code></strong> - if setting across models, the recursive level of models to do so,
          where <code>None</code> means all levels (default is 
          <code>None</code>)</li>
        <li><strong class="pname"><code>horizon</code></strong> (int)</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="setParameter"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">setParameter</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">name</span>,
        <span class="sig-arg">value</span>,
        <span class="sig-arg">model</span>=<span class="sig-default">None</span>,
        <span class="sig-arg">level</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setParameter">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Set a parameter value for the given model(s)</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>name</code></strong> (str) - the feature of the model to set</li>
        <li><strong class="pname"><code>value</code></strong> - the new value for the parameter</li>
        <li><strong class="pname"><code>model</code></strong> - the model to set the horizon for, where <code>None</code> means 
          set it for all (default is <code>None</code>)</li>
        <li><strong class="pname"><code>level</code></strong> - if setting across models, the recursive level of models to do so,
          where <code>None</code> means all levels (default is 
          <code>None</code>)</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="addAction"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">addAction</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">action</span>,
        <span class="sig-arg">condition</span>=<span class="sig-default">None</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.addAction">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>condition</code></strong> (<a href="psychsim.pwl.KeyedPlane-class.html" 
          class="link">KeyedPlane</a>) - optional legality condition</li>
    </ul></dd>
    <dt>Returns: <a href="psychsim.action.ActionSet-class.html" 
      class="link">ActionSet</a></dt>
        <dd>the action added</dd>
  </dl>
</td></tr></table>
</div>
<a name="getActions"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">getActions</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">vector</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.getActions">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns: {<a href="psychsim.action.ActionSet-class.html" 
      class="link">ActionSet</a>}</dt>
        <dd>the set of possible actions to choose from in the given state 
          vector</dd>
  </dl>
</td></tr></table>
</div>
<a name="setLegal"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">setLegal</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">action</span>,
        <span class="sig-arg">tree</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.setLegal">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Sets the legality decision tree for a given action</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>action</code></strong> - the action whose legality we are setting</li>
        <li><strong class="pname"><code>tree</code></strong> (<a href="psychsim.pwl.KeyedTree-class.html" 
          class="link">KeyedTree</a>) - the decision tree for the legality of the action</li>
    </ul></dd>
  </dl>
</td></tr></table>
</div>
<a name="hasAction"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">hasAction</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">atom</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.hasAction">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>atom</code></strong> (<a href="psychsim.action.Action-class.html" 
          class="link">Action</a>)</li>
    </ul></dd>
    <dt>Returns: bool</dt>
        <dd><code>True</code> iff this agent has the given action (possibly 
          in combination with other actions)</dd>
  </dl>
</td></tr></table>
</div>
<a name="reward"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">reward</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">vector</span>,
        <span class="sig-arg">model</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.reward">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns: float</dt>
        <dd>the reward I derive in the given state (under the given model, 
          default being the <code>True</code> model)</dd>
  </dl>
</td></tr></table>
</div>
<a name="addModel"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">addModel</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">name</span>,
        <span class="sig-arg">**kwargs</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.addModel">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Adds a new possible model for this agent (to be used as either true 
  model or else as mental model another agent has of it). Possible 
  arguments are:</p>
  <ul>
    <li>
      R: the reward table for the agent under this model (default is 
      <code>True</code>), <a href="psychsim.pwl.KeyedTree-class.html" 
      class="link">KeyedTree</a>&rarr;float
    </li>
    <li>
      beliefs: the beliefs the agent has under this model (default is 
      <code>True</code>), <a 
      href="psychsim.pwl.VectorDistribution-class.html" 
      class="link">VectorDistribution</a>
    </li>
    <li>
      horizon: the horizon of the value function under this model (default 
      is <code>True</code>),int
    </li>
    <li>
      level: the recursive depth of this model (default is 
      <code>True</code>),int
    </li>
    <li>
      rationality: the rationality parameter used in a quantal response 
      function when modeling others (default is 10),float
    </li>
  </ul>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>name</code></strong> (str) - the label for this model</li>
    </ul></dd>
    <dt>Returns: dict</dt>
        <dd>the model created</dd>
  </dl>
</td></tr></table>
</div>
<a name="model2index"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">model2index</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">model</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.model2index">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert a model name to a numeric representation</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>model</code></strong> (str) - the model name</li>
    </ul></dd>
    <dt>Returns: int</dt>
  </dl>
</td></tr></table>
</div>
<a name="index2model"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">index2model</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">index</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.index2model">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  <p>Convert a numeric representation of a model to a name</p>
  <dl class="fields">
    <dt>Parameters:</dt>
    <dd><ul class="nomargin-top">
        <li><strong class="pname"><code>index</code></strong> (int) - the numeric representation of the model</li>
    </ul></dd>
    <dt>Returns: str</dt>
  </dl>
</td></tr></table>
</div>
<a name="observe"></a>
<div>
<table class="details" border="1" cellpadding="3"
       cellspacing="0" width="100%" bgcolor="white">
<tr><td>
  <table width="100%" cellpadding="0" cellspacing="0" border="0">
  <tr valign="top"><td>
  <h3 class="epydoc"><span class="sig"><span class="sig-name">observe</span>(<span class="sig-arg">self</span>,
        <span class="sig-arg">state</span>,
        <span class="sig-arg">actions</span>,
        <span class="sig-arg">model</span>=<span class="sig-default">True</span>)</span>
  </h3>
  </td><td align="right" valign="top"
    ><span class="codelink"><a href="psychsim.agent-pysrc.html#Agent.observe">source&nbsp;code</a></span>&nbsp;
    </td>
  </tr></table>
  
  
  <dl class="fields">
    <dt>Returns:</dt>
        <dd>the post-observation beliefs of this agent</dd>
  </dl>
</td></tr></table>
</div>
<br />
<!-- ==================== NAVIGATION BAR ==================== -->
<table class="navbar" border="0" width="100%" cellpadding="0"
       bgcolor="#a0c0ff" cellspacing="0">
  <tr valign="middle">
  <!-- Home link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="psychsim.world.World-class.html">Home</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Tree link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="module-tree.html">Trees</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Index link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="identifier-index.html">Indices</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Help link -->
      <th>&nbsp;&nbsp;&nbsp;<a
        href="help.html">Help</a>&nbsp;&nbsp;&nbsp;</th>

  <!-- Project homepage -->
      <th class="navbar" align="right" width="100%">
        <table border="0" cellpadding="0" cellspacing="0">
          <tr><th class="navbar" align="center"
            ><a class="navbar" target="_top" href="http://pynadath.net:81/projects/psychsim">PsychSim</a></th>
          </tr></table></th>
  </tr>
</table>
<table border="0" cellpadding="0" cellspacing="0" width="100%%">
  <tr>
    <td align="left" class="footer">
    Generated by Epydoc 3.0.1 on Wed Oct 24 21:38:09 2012
    </td>
    <td align="right" class="footer">
      <a target="mainFrame" href="http://epydoc.sourceforge.net"
        >http://epydoc.sourceforge.net</a>
    </td>
  </tr>
</table>

<script type="text/javascript">
  <!--
  // Private objects are initially displayed (because if
  // javascript is turned off then we want them to be
  // visible); but by default, we want to hide them.  So hide
  // them unless we have a cookie that says to show them.
  checkCookie();
  // -->
</script>
</body>
</html>
